package logic

import (
	"context"
	"encoding/json"
	"github.com/olivere/elastic/v7"
	"server/models"
	"server/proto"
)

func (s *ServerRpc) EsSou(ctx context.Context, in *proto.EsSouReq) (*proto.EsSouRes, error) {
	query := elastic.NewRangeQuery("goods_inquire").Gte(10000)
	res, err := models.EsSouInfo(in.Index, query)
	data, _ := json.Marshal(res)
	if err != nil {
		return nil, err
	}
	return &proto.EsSouRes{Data: data}, nil
}
